/**
 * Witontek.com.
 * Copyright (c) 2012-2017 All Rights Reserved.
 */
package test.xml;

import java.lang.reflect.Field;

/**
 * 
 * @author Long
 * @version $Id: WxPayRefundReq.java, v 0.1 2017年2月19日 上午10:17:43  xiaolong.ma  Exp $
 */
public class WxPayRefundReq {
    /**  */
    private static final long serialVersionUID = 8611637265188099158L;
    //  https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4

    //    公众账号ID  appid   是   String(32)  wx8888888888888888  微信分配的公众账号ID（企业号corpid即为此appId）
    //    商户号 mch_id  是   String(32)  1900000109  微信支付分配的商户号
    //    设备号 device_info 否   String(32)  013467007045764 终端设备号
    //    随机字符串   nonce_str   是   String(32)  5K8264ILTKCH16CQ2502SI8ZNMTM67VS    随机字符串，不长于32位。推荐随机数生成算法
    //    签名  sign    是   String(32)  C380BEC2BFD727A4B6845133519F3AD6    签名，详见签名生成算法
    //    签名类型    sign_type   否   String(32)  HMAC-SHA256 签名类型，目前支持HMAC-SHA256和MD5，默认为MD5
    //    微信订单号   transaction_id  二选一 String(28)  1217752501201407033233368018    微信生成的订单号，在支付通知中有返回
    //    商户订单号   out_trade_no    String(32)  1217752501201407033233368018    商户侧传给微信的订单号
    //    商户退款单号  out_refund_no   是   String(32)  1217752501201407033233368018    商户系统内部的退款单号，商户系统内部唯一，同一退款单号多次请求只退一笔
    //    订单金额    total_fee   是   Int 100 订单总金额，单位为分，只能为整数，详见支付金额
    //    退款金额    refund_fee  是   Int 100 退款总金额，订单总金额，单位为分，只能为整数，详见支付金额
    //    货币种类    refund_fee_type 否   String(8)   CNY 货币类型，符合ISO 4217标准的三位字母代码，默认人民币：CNY，其他值列表详见货币类型
    //    操作员 op_user_id  是   String(32)  1900000109  操作员帐号, 默认为商户号
    //    退款资金来源  refund_account
    //    
    private String            appid;
    private String            mch_id;
    private String            device_info;
    private String            nonce_str;
    private String            sign;
    private String            sign_type;

    private String            transaction_id;

    private String            out_trade_no;
    private String            out_refund_no;
    private int               total_fee;
    private int               refund_fee;

    private String            refund_fee_type;
    private String            op_user_id;

    /**
     * Getter method for property <tt>appid</tt>.
     * 
     * @return property value of appid
     */
    public String getAppid() {
        return appid;
    }

    /**
     * Setter method for property <tt>appid</tt>.
     * 
     * @param appid value to be assigned to property appid
     */
    public void setAppid(String appid) {
        this.appid = appid;
    }

    /**
     * Getter method for property <tt>mch_id</tt>.
     * 
     * @return property value of mch_id
     */
    public String getMch_id() {
        return mch_id;
    }

    /**
     * Setter method for property <tt>mch_id</tt>.
     * 
     * @param mch_id value to be assigned to property mch_id
     */
    public void setMch_id(String mch_id) {
        this.mch_id = mch_id;
    }

    /**
     * Getter method for property <tt>device_info</tt>.
     * 
     * @return property value of device_info
     */
    public String getDevice_info() {
        return device_info;
    }

    /**
     * Setter method for property <tt>device_info</tt>.
     * 
     * @param device_info value to be assigned to property device_info
     */
    public void setDevice_info(String device_info) {
        this.device_info = device_info;
    }

    /**
     * Getter method for property <tt>nonce_str</tt>.
     * 
     * @return property value of nonce_str
     */
    public String getNonce_str() {
        return nonce_str;
    }

    /**
     * Setter method for property <tt>nonce_str</tt>.
     * 
     * @param nonce_str value to be assigned to property nonce_str
     */
    public void setNonce_str(String nonce_str) {
        this.nonce_str = nonce_str;
    }

    /**
     * Getter method for property <tt>sign</tt>.
     * 
     * @return property value of sign
     */
    public String getSign() {
        return sign;
    }

    /**
     * Setter method for property <tt>sign</tt>.
     * 
     * @param sign value to be assigned to property sign
     */
    public void setSign(String sign) {
        this.sign = sign;
    }

    /**
     * Getter method for property <tt>sign_type</tt>.
     * 
     * @return property value of sign_type
     */
    public String getSign_type() {
        return sign_type;
    }

    /**
     * Setter method for property <tt>sign_type</tt>.
     * 
     * @param sign_type value to be assigned to property sign_type
     */
    public void setSign_type(String sign_type) {
        this.sign_type = sign_type;
    }

    /**
     * Getter method for property <tt>transaction_id</tt>.
     * 
     * @return property value of transaction_id
     */
    public String getTransaction_id() {
        return transaction_id;
    }

    /**
     * Setter method for property <tt>transaction_id</tt>.
     * 
     * @param transaction_id value to be assigned to property transaction_id
     */
    public void setTransaction_id(String transaction_id) {
        this.transaction_id = transaction_id;
    }

    /**
     * Getter method for property <tt>out_trade_no</tt>.
     * 
     * @return property value of out_trade_no
     */
    public String getOut_trade_no() {
        return out_trade_no;
    }

    /**
     * Setter method for property <tt>out_trade_no</tt>.
     * 
     * @param out_trade_no value to be assigned to property out_trade_no
     */
    public void setOut_trade_no(String out_trade_no) {
        this.out_trade_no = out_trade_no;
    }

    /**
     * Getter method for property <tt>out_refund_no</tt>.
     * 
     * @return property value of out_refund_no
     */
    public String getOut_refund_no() {
        return out_refund_no;
    }

    /**
     * Setter method for property <tt>out_refund_no</tt>.
     * 
     * @param out_refund_no value to be assigned to property out_refund_no
     */
    public void setOut_refund_no(String out_refund_no) {
        this.out_refund_no = out_refund_no;
    }

    /**
     * Getter method for property <tt>total_fee</tt>.
     * 
     * @return property value of total_fee
     */
    public int getTotal_fee() {
        return total_fee;
    }

    /**
     * Setter method for property <tt>total_fee</tt>.
     * 
     * @param total_fee value to be assigned to property total_fee
     */
    public void setTotal_fee(int total_fee) {
        this.total_fee = total_fee;
    }

    /**
     * Getter method for property <tt>refund_fee</tt>.
     * 
     * @return property value of refund_fee
     */
    public int getRefund_fee() {
        return refund_fee;
    }

    /**
     * Setter method for property <tt>refund_fee</tt>.
     * 
     * @param refund_fee value to be assigned to property refund_fee
     */
    public void setRefund_fee(int refund_fee) {
        this.refund_fee = refund_fee;
    }

    /**
     * Getter method for property <tt>refund_fee_type</tt>.
     * 
     * @return property value of refund_fee_type
     */
    public String getRefund_fee_type() {
        return refund_fee_type;
    }

    /**
     * Setter method for property <tt>refund_fee_type</tt>.
     * 
     * @param refund_fee_type value to be assigned to property refund_fee_type
     */
    public void setRefund_fee_type(String refund_fee_type) {
        this.refund_fee_type = refund_fee_type;
    }

    /**
     * Getter method for property <tt>op_user_id</tt>.
     * 
     * @return property value of op_user_id
     */
    public String getOp_user_id() {
        return op_user_id;
    }

    /**
     * Setter method for property <tt>op_user_id</tt>.
     * 
     * @param op_user_id value to be assigned to property op_user_id
     */
    public void setOp_user_id(String op_user_id) {
        this.op_user_id = op_user_id;
    }

    public String toXml() {
        Field[] fields = this.getClass().getDeclaredFields();
        StringBuilder sb = new StringBuilder();
        sb.append("<xml>\n");
        for (Field field : fields) {
            Object obj;
            try {
                if (!"logger".equals(field.getName())) {
                    obj = field.get(this);
                    if (obj != null && !"".equals(obj)) {
                        sb.append("<").append(field.getName().trim()).append("><![CDATA[")
                            .append(obj).append("]]></").append(field.getName().trim())
                            .append(">\n");
                    }
                }
            } catch (Exception e) {
            }
        }
        sb.append("</xml>");
        return sb.toString();
    }

}
